Skip to content

Fix javascript undefined error when running tree-sitter generate#29

Closed
hectorhon wants to merge 1 commit intotree-sitter-grammars:masterfrom
hectorhon:master
Closed

Fix javascript undefined error when running tree-sitter generate#29
hectorhon wants to merge 1 commit intotree-sitter-grammars:masterfrom
hectorhon:master

Conversation

@hectorhon
Copy link

The following error occurs when I run tree-sitter generate at the repository root.

/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:676
  for (const [rule_name, rule] of Object.entries(grammar_json.rules)) {
                                                              ^
TypeError: Cannot read properties of undefined (reading 'rules')
    at global_alias (/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:676:63)
    at Object.<anonymous> (/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:567:39)
    at Module._compile (node:internal/modules/cjs/loader:1529:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)

The error started from this commit. The changes in this PR resolves the error, and the output files are produced correctly again.

/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:676
  for (const [rule_name, rule] of Object.entries(grammar_json.rules)) {
                                                              ^
TypeError: Cannot read properties of undefined (reading 'rules')
    at global_alias (/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:676:63)
    at Object.<anonymous> (/home/runner/work/tree-sitter-langs/tree-sitter-langs/repos/yaml/grammar.js:567:39)
    at Module._compile (node:internal/modules/cjs/loader:1529:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
@ObserverOfTime
Copy link
Member

You're using a very old version of the tree-sitter CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants